/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.Account;
/*    */ import com.zimbra.cs.account.Domain;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Provisioning.Result;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.cs.account.ldap.Check;
/*    */ import com.zimbra.cs.fb.ExchangeFreeBusyProvider.AuthScheme;
/*    */ import com.zimbra.cs.fb.ExchangeFreeBusyProvider.ServerInfo;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CheckExchangeAuth
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 40 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/*    */     
/* 42 */     Account authedAcct = getAuthenticatedAccount(zsc);
/* 43 */     Domain domain = Provisioning.getInstance().getDomain(authedAcct);
/*    */     
/* 45 */     checkRight(zsc, context, domain, Rights.Admin.R_checkExchangeAuthConfig);
/* 46 */     Element auth = request.getElement("auth");
/* 47 */     ExchangeFreeBusyProvider.ServerInfo sinfo = new ExchangeFreeBusyProvider.ServerInfo();
/* 48 */     sinfo.url = auth.getAttribute("url");
/* 49 */     sinfo.authUsername = auth.getAttribute("user");
/* 50 */     sinfo.authPassword = auth.getAttribute("pass");
/* 51 */     String scheme = auth.getAttribute("scheme");
/* 52 */     sinfo.scheme = ExchangeFreeBusyProvider.AuthScheme.valueOf(scheme);
/* 53 */     String type = auth.getAttribute("type", "webdav");
/*    */     Provisioning.Result r;
/* 55 */     Provisioning.Result r; if ("webdav".equals(type)) {
/* 56 */       r = Check.checkExchangeAuth(sinfo, authedAcct);
/*    */     } else {
/* 58 */       r = Check.checkExchangeEWSAuth(sinfo, authedAcct);
/*    */     }
/*    */     
/* 61 */     Element response = zsc.createElement(AdminConstants.CHECK_EXCHANGE_AUTH_RESPONSE);
/* 62 */     response.addElement("code").addText(r.getCode());
/* 63 */     String message = r.getMessage();
/* 64 */     if (message != null)
/* 65 */       response.addElement("message").addText(message);
/* 66 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 71 */     relatedRights.add(Rights.Admin.R_checkExchangeAuthConfig);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/CheckExchangeAuth.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */